package main.model.hexisland.eventprocessor;

import main.model.hexisland.listener.HexIslandListener;

import java.util.ArrayList;

public class HexIslandEventProcessorImp implements HexIslandEventProcessor {
	
	ArrayList<HexIslandListener> hexIslandListeners = new ArrayList<HexIslandListener>();
	
	public void addIslandListener(HexIslandListener listener)
	{
		hexIslandListeners.add(listener);
	}
	public void removeIslandListener(HexIslandListener listener)
	{
		if(hexIslandListeners.contains(listener)){
			hexIslandListeners.remove(hexIslandListeners.indexOf(listener));
		}
	}
	
	public void fireTileChangeEvent(int q, int r) {
		for (HexIslandListener il : hexIslandListeners) {
            il.onTileChange(q, r);
		}
	}

    public void fireIslandChange() {
        for (HexIslandListener il : hexIslandListeners) {
            il.onIslandChange();
        }
    }

}
